-- Clear procs & triggers
-- =============================================
DECLARE @curDB varchar(66), @sc nvarchar(333), @procname varchar(66), @triggerName varchar(66)
SET @curDB = db_name()

SET @sc = 'USE ' + @curDB
EXEC sp_executeSQL @sc

DECLARE c CURSOR local fast_forward read_only FOR
	SELECT name FROM SysObjects WHERE type='P'
OPEN c
FETCH next FROM c INTO @procname
WHILE @@FETCH_STATUS = 0 BEGIN
	SET @sc='DROP PROCEDURE '+ @procname
	EXEC sp_executeSQL @sc
	FETCH next FROM c INTO @procname
END
CLOSE c
DEALLOCATE c

DECLARE c CURSOR local fast_forward read_only FOR
	SELECT name FROM SysObjects WHERE type='TR'
OPEN c
FETCH next FROM c INTO @triggerName
WHILE @@FETCH_STATUS = 0 BEGIN
	SET @sc='DROP TRIGGER '+ @triggerName
	EXEC sp_executeSQL @sc
	FETCH next FROM c INTO @triggerName
END
CLOSE c
DEALLOCATE c